import Vue from 'vue'

// 2,先引入路由
import VueRouter from 'vue-router'

import Login from '../views/login'
import Register from '../views/register'
import Article from '../views/article'
import List from '../views/list'


// 3，使用路由
Vue.use(VueRouter)

// 4,创建路由
const router = new VueRouter({
  // route:一条路由规则
  routes:[
    {path:'/login',component:Login},
    {path:'/register', component:Register},
    {path:'/article',component:Article},
    {path:'/list',component:List},

  ]
})

// const originalPush= VueRouter.prototype.push
// VueRouter.prototype.push= function push(location){
// return originalPush.call(this,location).catch(err =>err)
// }

export default router